package com.arpa.wms.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Digits;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/**
 * <p>
 * 破损明细
 * </p>
 *
 * @author LEO
 * @since 2020-08-20
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wms_damaged_item")
@ApiModel(value="DamagedItem对象", description="破损明细")
public class DamagedItem extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "数据标识")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "所属机构")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "破损单号")
    @TableField("damaged_code")
    private String damagedCode;

    @ApiModelProperty(value = "商品编码code")
    @TableField("goods_code")
    @NotBlank(message = "报损明细商品不能为空", groups = {Damaged.Save.class, Damaged.Update.class})
    private String goodsCode;

    @ApiModelProperty(value = "商品编码")
    @TableField("good_code")
    @NotBlank(message = "报损明细商品条码不能为空", groups = {Damaged.Save.class, Damaged.Update.class})
    private String goodCode;

    @ApiModelProperty(value = "商品名称")
    @TableField("goods_name")
    @NotBlank(message = "报损明细商品不能为空", groups = {Damaged.Save.class, Damaged.Update.class})
    private String goodsName;

    @ApiModelProperty(value = "商品条码")
    @TableField("goods_bar_code")
    @NotBlank(message = "报损明细商品条码不能为空", groups = {Damaged.Save.class, Damaged.Update.class})
    private String goodsBarCode;

    @ApiModelProperty(value = "单位")
    @TableField("goods_unit")
    @NotBlank(message = "报损明细单位不能为空", groups = {Damaged.Save.class, Damaged.Update.class})
    private String goodsUnit;

    @ApiModelProperty(value = "基本单位报损数量")
    @TableField("quantity")
    private BigDecimal quantity;

    @ApiModelProperty(value = "基本单位实际报损数量")
    @TableField("actual_quantity")
    private BigDecimal actualQuantity;

    @ApiModelProperty(value = "单位报损数量")
    @TableField("unit_quantity")
    @Min(value = 1, message = "报损单明细单位报损数量不能小于等于0", groups = {Damaged.Save.class, Damaged.Update.class})
    @Digits(integer = 20, fraction = 6, groups = {Damaged.Save.class, Damaged.Update.class})
    private BigDecimal unitQuantity;

    @ApiModelProperty(value = "单位实际报损数量")
    @TableField("actual_unit_quantity")
    private BigDecimal actualUnitQuantity;

    @ApiModelProperty(value = "状态")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "批号")
    @TableField("lot_id")
    private String lotId;

    @ApiModelProperty(value = "库存code")
    @TableField("inventory_code")
    private String inventoryCode;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 255, message = "明细备注长度不能大于255个字符", groups = {Damaged.Save.class, Damaged.Update.class})
    private String remarks;

    @ApiModelProperty(value = "单位名称")
    @TableField("goods_unit_name")
    private String goodsUnitName;

    @ApiModelProperty(value = "规格")
    @TableField("spec")
    private String spec;

    @ApiModelProperty(value = "保质期（天）")
    @TableField("expiration_quantity")
    private BigDecimal expirationQuantity;

    @ApiModelProperty(value = "基本单位")
    @TableField("basic_unit")
    @NotBlank(message = "报损明细基本单位不能为空", groups = {Damaged.Save.class, Damaged.Update.class})
    private String basicUnit;

    @ApiModelProperty(value = "基本单位名称")
    @TableField("basic_unit_name")
    private String basicUnitName;

    @ApiModelProperty(value = "基本单位转换数量")
    @TableField("basic_quantity")
    private BigDecimal basicQuantity;


}
